.SUFFIXES : .x .o .c .s

BUILD_ROOT=/usr/local/arm_tools
lib1=${BUILD_ROOT}/lib/gcc-lib/arm-elf/3.0
lib=${BUILD_ROOT}/arm-elf/lib

include=${BUILD_ROOT}/arm-elf/inc/
.SUFFIXES : .x .o .c .s

ROOT = /usr/local/arm_tools
LIB = $(ROOT)/lib/gcc-lib/arm-elf/3.0
LIB1 =$(ROOT)/arm-elf/lib
LIB2 =$(shell pwd)
INC :=$(ROOT)/arm-elf/inc
LINUX_SRC = /opt/nuc700/uclinux/nuc700-uClinux/uClinux-dist/linux-2.4.x


CC=arm-elf-gcc -I$(INC) -I$(LINUX_SRC)/include -O1 -Wl,-elf2flt='-s 300000'
WEC_LDFLAGS=-L./lib -L$(LIB) -L$(LIB1) -L$(LIB2)

#CC=arm-elf-gcc -I${include}  -O1 -Wl,-elf2flt='-s 300000'
#WEC_LDFLAGS=-L./ -L${lib} -L${lib}/lib -L${lib}/libc  -L${lib1} -L$(LIB2)

TARGET = obdapp
#SRCS := config.c obdapp.c obddebug.c obduart.c stn.c sysutils.c gps.c cal.c sound.c vehiclestatus.c
#LIBS= -lobd -lgps -lrtc -lpthread  -lc -lgcc -lc
SRCS := config.c obdapp.c obddebug.c obduart.c stn.c sysutils.c cal.c sound.c vehiclestatus.c
LIBS= -lobd -lrtc -lpthread -lc -lgcc -lc
#-lsound
#all: librtc.a libobd.a libgps.a
all: librtc.a libobd.a
# libsound.a
	$(CC) $(WEC_LDFLAGS) $(SRCS) -o $(TARGET) $(LIBS)
	chmod 777 $(TARGET)
	chmod +x $(TARGET)

librtc.a:
	make -C librtc

libobd.a:
	make -C libobd

#libgps.a:
#	make -C libgps

#libirq.a:
#	make -C libirq

#libsound.a:
#	make -C libsound

clean:
	rm -f *.o 
	rm -f *.x 
	rm -f *.flat
	rm -f *.map
	rm -f temp
	rm -f *.img
	rm -f $(TARGET)	
	rm -f *.gdb
